package com.ftio.study.controller;

import com.ftio.study.annotation.*;
import com.ftio.study.service.MyServices;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@MyController
@MyRequestMapping("/my")
public class MyControllers {

    @MyAutowired("MyServiceImpl")
    private MyServices myServices;

    @MyRequestMapping("/query")
    public void query(HttpServletRequest request, HttpServletResponse response,
                      @MyRequestParam("name") String name,
                      @MyRequestParam("age") String age) throws IOException {
        PrintWriter ps = response.getWriter();
        String result = myServices.query(name, age);
        ps.write(result);
    }
}
